import request from '@/components/utils/request.js'
import {useTokenStore} from '@/stores/token.js'
import { ref } from 'vue'

//文章分类列表查询
export const articleCategoyListService=()=>{
   // const tokenStore = useTokenStore();
  //  tokenStore.token;
//在pinia中应以的响应式数据,不需要.value
   // return request.get('/category',{headers:{"Authorization":tokenStore.token}})
   return request.get('/category')

}

export const articleCategoryAddService = (categoryData)=>{
    return request.post('/category',categoryData);
}

export const updateCategoryService = (categoryData)=>{
   return request.put('/category',categoryData);
}



//文章分类删除
export const articleCategoryDeleteService = (Id)=>{
   return request.get('/category/delete?id='+Id);

}

//文章列表查询
export const articleListService = (params)=>{
   return  request.get('/article',{params:params})
}

//文章添加
export const articleAddService=(article)=>{
   return request.post('/article',article);
}

export const updateArticleService=(article)=>{
   return request.put('/article',article);
}

//文章分类删除
export const articleDeleteService = (Id)=>{
   return request.delete('/article?id='+Id);
}